#!/usr/bin/env python3
import os
from pathlib import Path

def main():
    # 获取当前脚本所在目录的上级目录
    script_path = Path(__file__).resolve()
    root_dir = script_path.parent.parent

    # 统计删除数量
    deleted = 0

    print(f"Scanning: {root_dir}")

    # 遍历所有文件
    for filepath in root_dir.rglob('.keep'):
        if filepath.is_file():
            try:
                filepath.unlink()
                print(f"Deleted: {filepath}")
                deleted += 1
            except Exception as e:
                print(f"Failed to delete {filepath}: {e}")

    print(f"\nDone. Deleted {deleted} '.keep' file(s).")

if __name__ == "__main__":
    main()
